import request from '/@/utils/request';

export function dictApi() {
	return {
		create: (data: object) => {
			return request({
				url: '/sys/dict/create',
				method: 'POST',
				data,
			});
		},
		update: (data: object) => {
			return request({
				url: '/sys/dict/update',
				method: 'PUT',
				data,
			});
		},
		view: (id: string) => {
			return request({
				url: `/sys/dict/view/${id}`,
				method: 'GET',
			});
		},

		remove: (id: string) => {
			return request({
				url: `/sys/dict/delete/${id}`,
				method: 'DELETE',
			});
		},
		batchDelete: (data: object) => {
			return request({
				url: '/sys/dict/batch/delete',
				method: 'POST',
				data,
			});
		},
		pageSearch: (data: object) => {
			return request({
				url: '/sys/dict/search',
				method: 'POST',
				data,
			});
		},
		listCategory: () => {
			return request({
				url: '/sys/dict/list/category',
				method: 'GET',
			});
		},
		queryByCategory: (category: string) => {
			return request({
				url: `/sys/dict/category?category=${category}`,
				method: 'GET',
			});
		},
	};
}
